import os
from python_baway.common.xcommon import sep


def xread_dirs(xdir):
    if os.path.isfile(xdir):
        with open(xdir, 'r') as xfile:
            sep(xdir)
            print(xfile.read())
    elif os.path.isdir(xdir):
        xitems = os.listdir(xdir)
        xitems.sort()
        for xi in xitems:
            xread_dirs(os.path.join(xdir, xi))


xread_dirs('x_create_log_dirs.tmp.dir')
